package com.digitalchina.lxnsy.activity.old;

import android.os.Bundle;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.base.BaseActivity;
import com.digitalchina.lxnsy.entity.ShareFarmListVO;
import com.digitalchina.lxnsy.toolkit.JointImageUrl;
import com.lzy.ninegrid.ImageInfo;
import com.lzy.ninegrid.NineGridView;
import com.lzy.ninegrid.preview.NineGridViewClickAdapter;

import java.util.ArrayList;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.activity
 * 创建人：郑皓
 * 创建时间：2018/8/15 10:25
 * 修改备注：
 * ================================================
 */
public class ShareFarmImageActivity extends BaseActivity {

    @Bind(R.id.tv_introduce)
    TextView tvIntroduce;
    @Bind(R.id.nineGrid)
    NineGridView nineGrid;

    @Override
    public void setLayout() {
        setContentLayout(R.layout.activity_share_image);
        setTitle("商品详情");
    }

    @Override
    public void initMember() {

        ShareFarmListVO vo = (ShareFarmListVO) getIntent().getSerializableExtra("ShareFarmListVO");

        if (vo != null) {
            if (vo.getImgPath() != null) {

                ArrayList<ImageInfo> imageInfo = new ArrayList<>();
                String[] strings = vo.getImgPath().split(",");
                for (int i = 0; i < strings.length; i++) {
                    ImageInfo info = new ImageInfo();
                    info.setThumbnailUrl(JointImageUrl.smallImageUrl(strings[i]));
                    info.setBigImageUrl(JointImageUrl.bigImageUrl(strings[i]));
                    imageInfo.add(info);
                }
                nineGrid.setAdapter(new NineGridViewClickAdapter(this, imageInfo));
            }
            tvIntroduce.setText(vo.getIntroduce() + "");
        }


    }

    @Override
    public void addListener() {

    }

    @Override
    public void setHandler() {

    }

    @Override
    public void callBack(Object object) {

    }

    @Override
    public void rightOnClick() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
